import React, { Component } from 'react'
import Father from './Father'
import { Provider } from '../utils/context'

// createContext创建上下文
// Provider(提供数据)
// Consumer(使用数据)

class Grand extends Component {
    state = {
        count: 200
    }
    render() {
        const { count } = this.state
        return (
            <div>
                <h2>
                    我是爷爷组件 -- { count }
                </h2>
                <Provider value = { count }>
                    <Father/>
                </Provider>
            </div>
        )
    }
}

export default Grand
 